import React, { Component, PropTypes } from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter, HashRouter, Match, Miss, Link } from 'react-router';
import { Layout, Button, Menu, Icon } from 'antd';
import * as SA from 'superagent';

import Navigator from '../navigator/navigator.jsx';
import Index from "../../routes/Index.jsx";
import Products from "../../routes/Products.jsx";

import 'antd/dist/antd.min.css';
import "../../../www/css/default.scss";

const {Header, Footer, Sider, Content} = Layout;

class HomeLayout extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            navigator: {
                links: [
                    {
                        path: '/',
                        pathname: '首页'
                    }
                ],
                components: [
                    {
                        path: '/',
                        component: Index,
                        exactly: true
                    },
                    {
                        path: '/products',
                        component: Products,
                        exactly: false
                    }
                ]
            }
        }
    }

    render() {
        const navigator = this.state.navigator;
        return (
            <Navigator {...navigator}></Navigator>
        );
    }
}

HomeLayout.propTypes = {
    navigator: PropTypes.arrayOf(PropTypes.shape({
        links: PropTypes.arrayOf(PropTypes.shape({
            path: PropTypes.string,
            pathname: PropTypes.string
        })),
        components: PropTypes.arrayOf(PropTypes.shape({
            path: PropTypes.string,
            component: PropTypes.object
        }))
    }))
};

ReactDOM.render(
    <HomeLayout />,
    document.getElementById('root')
);
